package com.freexiaoyu.cloud.ui.base;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;


public abstract class BaseActivityT<P extends ViewDataBinding> extends AppCompatActivity {
    protected Context mContext;
    protected Intent mIntent;
    protected int PAGE_INDEX = 1;//当前页码只有在列表中用到
    protected P mBinding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mIntent = getIntent();
        mContext = this;
        init();

        mBinding = DataBindingUtil.setContentView(this, provideContentViewId());
        initView(savedInstanceState);
        initData();
        initListener();
    }


    protected abstract int provideContentViewId();//用于引入布局文件

    /***
     * 在初始化布局之前操作
     */
    protected abstract void init();

    /***
     * 布局初始化完成后控件初始化
     */
    protected abstract void initView(Bundle savedInstanceState);

    /***
     * 在初始化布局之前操作
     */
    protected abstract void initData();

    /***
     * 事件
     */
    protected abstract void initListener();



}
